package com.file.exercise;

import java.io.File;
import java.io.IOException;

/**
 * @author げっしょく
 * @date 2021/7/31
 */
public class Test4 {
    public static void main(String[] args) throws IOException {
        //methon();
        //methon2();
        File file = new File("D:\\aa");
        if(!file.exists()){
            file.mkdirs();
        }
        String name = file.getName();
        System.out.println(name);
        File file1 = new File(file, "a.txt");
    }

    private static void methon2() throws IOException {
        File file = new File("D:\\aa\\bb");
        boolean mkdirs = file.mkdirs();
        System.out.println(mkdirs);
        File file1 = new File(file, "a.txt");
        System.out.println(file1.createNewFile());
    }

    private static void methon() throws IOException {
        File file = new File("D:\\Git\\a.txt");
        boolean newFile = file.createNewFile();
        System.out.println(newFile);
        File file1 = new File("a.txt");
        boolean newFile1 = file1.createNewFile();
        System.out.println(newFile1);
    }
}
